package com.codeoss.framework.webide.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.codeoss.framework.webide.request.DetailReportDesignerRequest;
import com.codeoss.framework.webide.response.DetailReportDesignerResponse;
import com.codeoss.framework.webide.service.IDetailReportDesignerService;

@Controller
@RequestMapping("detailreportdesigner")
public class DetailReportDesignerController {
	@Autowired
	private IDetailReportDesignerService detailReportDesignerService;
	
	@RequestMapping(value = "initDataSourceConfigPage", method = RequestMethod.GET)
	@ResponseBody
	public DetailReportDesignerResponse initDataSourceConfigPage(@RequestParam("code") String code){
		DetailReportDesignerResponse detailReportDesignerResponse=detailReportDesignerService.initDataSourceConfigPage(code);
		return detailReportDesignerResponse;
	}
	
	@RequestMapping(value = "initDisplayFieldConfigPage", method = RequestMethod.GET)
	@ResponseBody
	public DetailReportDesignerResponse initDisplayFieldConfigPage(@RequestParam("code") String code,@RequestParam("tableName") String tableName){
		DetailReportDesignerResponse detailReportDesignerResponse=detailReportDesignerService.initDisplayFieldConfigPage(code,tableName);
		return detailReportDesignerResponse;
	}
	
	@RequestMapping(value = "initFieldConditionStylePage", method = RequestMethod.GET)
	@ResponseBody
	public DetailReportDesignerResponse initFieldConditionStylePage(@RequestParam("code") String code){
		DetailReportDesignerResponse detailReportDesignerResponse=detailReportDesignerService.initFieldConditionStylePage(code);
		return detailReportDesignerResponse;
	}
	
	@RequestMapping(value = "initReportPreviewPage", method = RequestMethod.POST)
	@ResponseBody
	public DetailReportDesignerResponse initReportPreviewPage(@RequestBody DetailReportDesignerRequest request){
		DetailReportDesignerResponse detailReportDesignerResponse=detailReportDesignerService.initReportPreviewPage(request);
		return detailReportDesignerResponse;
	}
	
	@RequestMapping(value = "onFinish", method = RequestMethod.POST)
	@ResponseBody
	public DetailReportDesignerResponse onFinish(@RequestBody DetailReportDesignerRequest request){
		DetailReportDesignerResponse detailReportDesignerResponse=detailReportDesignerService.onFinish(request);
		return detailReportDesignerResponse;
	}
	
	@RequestMapping(value = "previewPageDataPage", method = RequestMethod.POST)
	@ResponseBody
	public DetailReportDesignerResponse previewPageDataPage(@RequestBody DetailReportDesignerRequest request){
		DetailReportDesignerResponse detailReportDesignerResponse=detailReportDesignerService.previewPageDataPage(request);
		return detailReportDesignerResponse;
	}
}
